package com.xiaoke.service;

import com.xiaoke.entity.Cart;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@RestController
public interface CartService {

    @GetMapping("/cart/selectByPrimaryKey")
    Cart selectByPrimaryKey(@RequestParam("id") String id);

    @PostMapping("/cart/insert")
    void insert(@RequestBody Cart cart);

    @GetMapping("/cart/findByUserAndShop")
    List<Map<String,Object>> findByUserAndShop(@RequestParam("userId") String userId, @RequestParam("shopId") String shopId);

    @PostMapping
    Cart findByParams(@RequestBody Map<String,Object> params);

    @PostMapping("/cart/updateByPrimaryKeySelective")
    void updateByPrimaryKeySelective(Cart cart);

    @PostMapping("/cart/deleteByIds")
    void delete(@RequestBody String... id);

    @GetMapping("/cart/sumByChecked")
    BigDecimal sumByChecked(@RequestParam("userId") String userId, @RequestParam("shopId") String shopId);

    @GetMapping("/cart/findByChecked")
    List<Map<String,Object>> findByChecked(@RequestParam("userId") String userId,@RequestParam("shopId") String shopId);

    @GetMapping("/cart/sumTotalPriceByChecked")
    Map<String,Object> sumTotalPriceByChecked(@RequestParam("userId") String userId,@RequestParam("shopId") String shopId);

    @GetMapping("/cart/countByUserAndShopAndUnChecked")
    Integer countByUserAndShopAndUnChecked(@RequestParam("userId") String userId,@RequestParam("shopId") String shopId);
}
